﻿using System;
using System.Collections.Generic;
using System.Text;


namespace Atosenet.PluginEngine
{
    public interface IPluginHost 
    {
        event PluginEventHandler PluginLoaded;
        event PluginEventHandler PluginUnloaded;

        bool Load(IPlugin plugin);
        void LoadFrom(string pluginDir, bool includeAllDirs);
        bool LoadFrom(string pluginName, string pluginDir, bool includeAllDirs);
        void Unload();
        bool SetPluginEnable(string pluginName, bool enable);

        PluginCollection Plugins { get; }
    }


    public delegate void PluginEventHandler(object sender, PluginEventArgs e);

    public class PluginEventArgs : EventArgs
    {
        public IPlugin Plugin;
        public PluginAttribute PluginProperty;
        public DateTime Timestamp;

        public PluginEventArgs(IPlugin plugin, PluginAttribute property)
        {
            Plugin = plugin;
            PluginProperty = property;
            Timestamp = DateTime.Now;
        }
    }
}
